<?php 
	session_name("sesiondirh");
	session_start(); 
	
	include_once 'clases_php/MiScore.php';
	include_once 'clases_php/Administrador.php';
	$nick = $_POST["usuario"];
	$pass = $_POST["pass"];
	
	$miscore = new MiScore();
	$admin = new Administrador();
	$admin = $miscore->autenticarUsuario($nick, $pass);
	if($admin->id>0){
		if (!isset($_SESSION["id_admin"])) 
			$_SESSION["id_admin"] = $admin;
		echo "<script>window.location='torneos.php'</script>"; 
	}else{
		echo "<script>alert('Usuario y/o contraseña erroneos, vuelva a ingresar los datos');
		window.location='ingresar.php'</script>";
	}
	
?>